import AndIcon from '../assets/and-icon.svg';
import CatchIcon from '../assets/catch-icon.svg';
import ChainIcon from '../assets/chain-icon.svg';
import CommonIcon from '../assets/common-icon.svg';
import EndIcon from '../assets/end-icon.svg';
import ForIcon from '../assets/for-icon.svg';
import IfIcon from '../assets/if-icon.svg';
import IntermediateEndIcon from '../assets/intermediate-end-icon.svg';
import IteratorIcon from '../assets/iterator-icon.svg';
import NotIcon from '../assets/not-icon.svg';
import OrIcon from '../assets/or-icon.svg';
import StartIcon from '../assets/start-icon.svg';
import SwitchIcon from '../assets/switch-icon.svg';
import ThenIcon from '../assets/then-icon.svg';
import VirtualIcon from '../assets/virtual-icon.svg';
import WhenIcon from '../assets/when-icon.svg';
import WhileIcon from '../assets/while-icon.svg';
import { ConditionTypeEnum, NodeTypeEnum, NODE_TYPE_INTERMEDIATE_END } from '../constant/index.js';

const ICON_MAP = {
  [NodeTypeEnum.COMMON]: CommonIcon,
  [NodeTypeEnum.SWITCH]: SwitchIcon,
  [NodeTypeEnum.IF]: IfIcon,
  [NodeTypeEnum.FOR]: ForIcon,
  [NodeTypeEnum.WHILE]: WhileIcon,
  [NodeTypeEnum.ITERATOR]: IteratorIcon,
  [NodeTypeEnum.BREAK]: IntermediateEndIcon,
  [NodeTypeEnum.BREAK_SCRIPT]: IntermediateEndIcon,
  [NodeTypeEnum.BOOLEAN]: IfIcon,
  [NodeTypeEnum.BOOLEAN_SCRIPT]: IfIcon,
  [NodeTypeEnum.SWITCH_SCRIPT]: SwitchIcon,
  [NodeTypeEnum.IF_SCRIPT]: IfIcon,
  [NodeTypeEnum.FOR_SCRIPT]: ForIcon,
  [NodeTypeEnum.WHILE_SCRIPT]: WhileIcon,
  [NodeTypeEnum.VIRTUAL]: VirtualIcon,
  [NodeTypeEnum.SCRIPT]: CommonIcon,
  [NodeTypeEnum.FALLBACK]: CommonIcon,
  [NODE_TYPE_INTERMEDIATE_END]: IntermediateEndIcon,
  [ConditionTypeEnum.THEN]: ThenIcon,
  [ConditionTypeEnum.WHEN]: WhenIcon,
  [ConditionTypeEnum.SWITCH]: SwitchIcon,
  [ConditionTypeEnum.IF]: IfIcon,
  [ConditionTypeEnum.FOR]: ForIcon,
  [ConditionTypeEnum.WHILE]: WhileIcon,
  [ConditionTypeEnum.ITERATOR]: IteratorIcon,
  [ConditionTypeEnum.CHAIN]: ChainIcon,
  [ConditionTypeEnum.CATCH]: CatchIcon,
  [ConditionTypeEnum.AND]: AndIcon,
  [ConditionTypeEnum.OR]: OrIcon,
  [ConditionTypeEnum.NOT]: NotIcon,
};

export const getIconByType = (type) => {
  return ICON_MAP[type] || CommonIcon;
};

export const getStartIcon = () => StartIcon;
export const getEndIcon = () => EndIcon;

